package com.xiaoke.java1;

/**
 * @author yd
 * @version 1.0
 * @date 2022/1/5 23:08
 */
public class ClassLoaderTest2 {

    public static void main(String[] args) {
        try {
            //1.
            ClassLoader classLoader = Class.forName("java.lang.String").getClassLoader();
            System.out.println(classLoader);//null bootstrapclassloader 启动类加载器

            //2.
            ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
            System.out.println(contextClassLoader);//sun.misc.Launcher$AppClassLoader@18b4aac2

            //3.
            ClassLoader classLoader1 = ClassLoader.getSystemClassLoader().getParent();
            System.out.println(classLoader1);//sun.misc.Launcher$ExtClassLoader@4554617c

        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

    }
}
